#include <WallTileA.h>

#include <RenderObject.h>
#include <GraphicData.h>
#include <RenderManager.h>
#include <PhysicsObject.h>
#include <Physics.h>
#include <ObjectManager.h>

WallTileA::WallTileA()
{
	syncComplete = 0;

	float WallColor[4] = {0.0,1,0.0,1};
	gfx = External::renderer->CreateRenderObject( &t, External::renderer->LoadGfxFromBMP( "./Graphics/GroundTile.bmp" ) );
	gfx->SetColor(0, WallColor[0], WallColor[1], WallColor[2]);
	gfx->gfx->solid[0] = 1;

	t.loc = vec2(100,100);
	t.angle = 0;
	t.scale = 0.5f;

	//velocity = vec2( -10 + 20*Global::GetRandomFloat(), -10 + 20*Global::GetRandomFloat() );


	phys = new PhysicsObject( this, &t, External::physics->LoadBoundingBox("./Graphics/WallTileA.bb"), b2_staticBody );
	
	phys->body->SetTransform( t.loc, -t.angle * Global::PI / 180.0f );
	//phys->body->SetLinearVelocity( velocity );
}

WallTileA::~WallTileA()
{
	delete phys;
}
	
std::string WallTileA::GetTypeName()
{
	return "WallTileA";
}
	
std::string WallTileA::GetTextName()
{
	return "Wall Tile A";
}

void WallTileA::Update(float dt)
{
	if(!syncComplete)
		SyncTransformToPhysics();
	syncComplete=1;
}
		
void WallTileA::DoCollision(BaseObject* objectCollidedWith)
{
	
}
